// SPDX-License-Identifier: GPL-2.0
/*
 * Device Tree file for Seagate NAS 4-Bay (Armada 370 SoC).
 *
 * Copyright (C) 2015 Seagate
 *
 * Author: Vincent Donnefort <vdonnefort@gmail.com>
 */

/*
 * Here are some information allowing to identify the device:
 *
 * Product name                 : Seagate NAS 4-Bay
 * Code name (board/PCB)        : Dart 4-Bay
 * Model name (case sticker)    : SRPD40
 * Material desc (product spec) : STCUxxxxxxx
 */

/dts-v1/;
#include "armada-370-seagate-nas-xbay.dtsi"
#include <dt-bindings/leds/leds-ns2.h>

/ {
	model = "Seagate NAS 4-Bay (Dart, SRPD40)";
	compatible = "seagate,dart-4", "marvell,armada370", "marvell,armada-370-xp";

	soc {
		internal-regs {
			ethernet@74000 {
				status = "okay";
				pinctrl-0 = <&ge1_rgmii_pins>;
				pinctrl-names = "default";
				phy = <&phy1>;
				phy-mode = "rgmii-id";
			};

			i2c@11000 {
				/* I2C GPIO expander (PCA9554A) */
				pca9554: pca9554@21 {
					compatible = "nxp,pca9554";
					reg = <0x21>;
					#gpio-cells = <2>;
					gpio-controller;
				};
			};
		};
	};

	regulators {
		regulator@3 {
			compatible = "regulator-fixed";
			reg = <3>;
			regulator-name = "SATA2 power";
			regulator-min-microvolt = <5000000>;
			regulator-max-microvolt = <5000000>;
			enable-active-high;
			regulator-always-on;
			regulator-boot-on;
			gpio = <&pca9554 6 GPIO_ACTIVE_HIGH>;
		};
		regulator@4 {
			compatible = "regulator-fixed";
			reg = <4>;
			regulator-name = "SATA3 power";
			regulator-min-microvolt = <5000000>;
			regulator-max-microvolt = <5000000>;
			enable-active-high;
			regulator-always-on;
			regulator-boot-on;
			gpio = <&pca9554 7 GPIO_ACTIVE_HIGH>;
		};
	};

	gpio-leds {
		red-sata2 {
			label = "dart:red:sata2";
			gpios = <&pca9554 0 GPIO_ACTIVE_LOW>;
		};
		red-sata3 {
			label = "dart:red:sata3";
			gpios = <&pca9554 3 GPIO_ACTIVE_LOW>;
		};
	};

	leds-ns2 {
		compatible = "lacie,ns2-leds";

		white-sata2 {
			label = "dart:white:sata2";
			cmd-gpio = <&pca9554 1 GPIO_ACTIVE_HIGH>;
			slow-gpio = <&pca9554 2 GPIO_ACTIVE_HIGH>;
			num-modes = <4>;
			modes-map = <NS_V2_LED_SATA 0 0
				     NS_V2_LED_OFF  0 1
				     NS_V2_LED_ON   1 0
				     NS_V2_LED_ON   1 1>;
		};
		white-sata3 {
			label = "dart:white:sata3";
			cmd-gpio = <&pca9554 4 GPIO_ACTIVE_HIGH>;
			slow-gpio = <&pca9554 5 GPIO_ACTIVE_HIGH>;
			num-modes = <4>;
			modes-map = <NS_V2_LED_SATA 0 0
				     NS_V2_LED_OFF  0 1
				     NS_V2_LED_ON   1 0
				     NS_V2_LED_ON   1 1>;
		};
	};

	gpio-fan {
		gpio-fan,speed-map =
			<   0 3
			  800 2
			  1050 1
			  1300 0>;
	};
};

&pciec {
	/* SATA AHCI controller 88SE9170 */
	pcie@1,0 {
		status = "okay";
	};
};

&mdio {
	phy1: ethernet-phy@1 {
		reg = <1>;
	};
};

